package com.entity;

import com.vo.MailUser;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author 
 */
public class Dietitian extends MailUser implements Serializable,Account {
    /**
     * 编号
     */
    private String did;

    /**
     * 等级编号
     */
    private String ltid;

    /**
     * 营养师姓名
     */
    private String dname;

    /**
     * 性别
     */
    private String dsex;

    /**
     * 生日
     */
    private Date dbirthday;

    /**
     * 参加工作时间
     */
    private Date djointime;

    /**
     * 营养师介绍
     */
    private String ddesc;

    /**
     * 价格/天执行
     */
    private Integer dprice;

    /**
     * 密码
     */
    private String dpwd;

    /**
     * 照片
     */
    private String dpic;

    private String demail;

    //shiro 准备 登录用的 成员变量和方法
    String salt;//加密用的盐
    Integer isDelete;
    Date createDate;
    Boolean locked = Boolean.FALSE;//是否锁定

    List<AccountRole> accountRoles;
    @Override
    public String getAccountid() {
        return did;
    }



    @Override
    public String getAccountname() {
        return dname;
    }



    @Override
    public String getPassword() {
        return dpwd;
    }



    @Override
    public String getSalt() {
        return salt;
    }


    public void setSalt(String salt) {
        this.salt = salt;
    }

    @Override
    public Integer getIsDelete() {
        return isDelete;
    }


    public void setIsDelete(Integer isDelete) {
        this.isDelete = isDelete;
    }

    @Override
    public Date getCreateDate() {
        return createDate;
    }


    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    @Override
    public Boolean getLocked() {
        return locked;
    }


    public void setLocked(Boolean locked) {
        this.locked = locked;
    }

    @Override
    public List<AccountRole> getAccountRoles() {
        return accountRoles;
    }


    public void setAccountRoles(List<AccountRole> accountRoles) {
        this.accountRoles = accountRoles;
    }

    public String getCredentialsSalt()
    {
        return getAccountname() + salt;
    }
    //结束    shiro 准备 登录用的 成员变量和方法


    private static final long serialVersionUID = 1L;

    public String getDid() {
        return did;
    }

    public void setDid(String did) {
        this.did = did;
    }

    public String getLtid() {
        return ltid;
    }

    public void setLtid(String ltid) {
        this.ltid = ltid;
    }

    public String getDname() {
        return dname;
    }

    public void setDname(String dname) {
        this.dname = dname;
        this.mailName = dname;
    }

    public String getDsex() {
        return dsex;
    }

    public void setDsex(String dsex) {
        this.dsex = dsex;
    }

    public Date getDbirthday() {
        return dbirthday;
    }

    public void setDbirthday(Date dbirthday) {
        this.dbirthday = dbirthday;
    }

    public Date getDjointime() {
        return djointime;
    }

    public void setDjointime(Date djointime) {
        this.djointime = djointime;
    }

    public String getDdesc() {
        return ddesc;
    }

    public void setDdesc(String ddesc) {
        this.ddesc = ddesc;
    }

    public Integer getDprice() {
        return dprice;
    }

    public void setDprice(Integer dprice) {
        this.dprice = dprice;
    }

    public String getDpwd() {
        return dpwd;
    }

    public void setDpwd(String dpwd) {
        this.dpwd = dpwd;
    }

    public String getDpic() {
        return dpic;
    }

    public void setDpic(String dpic) {
        this.dpic = dpic;
    }

    public String getDemail() {
        return demail;
    }

    public void setDemail(String demail) {
        this.demail = demail;
        this.mailAddress = demail;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Dietitian other = (Dietitian) that;
        return (this.getDid() == null ? other.getDid() == null : this.getDid().equals(other.getDid()))
            && (this.getLtid() == null ? other.getLtid() == null : this.getLtid().equals(other.getLtid()))
            && (this.getDname() == null ? other.getDname() == null : this.getDname().equals(other.getDname()))
            && (this.getDsex() == null ? other.getDsex() == null : this.getDsex().equals(other.getDsex()))
            && (this.getDbirthday() == null ? other.getDbirthday() == null : this.getDbirthday().equals(other.getDbirthday()))
            && (this.getDjointime() == null ? other.getDjointime() == null : this.getDjointime().equals(other.getDjointime()))
            && (this.getDdesc() == null ? other.getDdesc() == null : this.getDdesc().equals(other.getDdesc()))
            && (this.getDprice() == null ? other.getDprice() == null : this.getDprice().equals(other.getDprice()))
            && (this.getDpwd() == null ? other.getDpwd() == null : this.getDpwd().equals(other.getDpwd()))
            && (this.getDpic() == null ? other.getDpic() == null : this.getDpic().equals(other.getDpic()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getDid() == null) ? 0 : getDid().hashCode());
        result = prime * result + ((getLtid() == null) ? 0 : getLtid().hashCode());
        result = prime * result + ((getDname() == null) ? 0 : getDname().hashCode());
        result = prime * result + ((getDsex() == null) ? 0 : getDsex().hashCode());
        result = prime * result + ((getDbirthday() == null) ? 0 : getDbirthday().hashCode());
        result = prime * result + ((getDjointime() == null) ? 0 : getDjointime().hashCode());
        result = prime * result + ((getDdesc() == null) ? 0 : getDdesc().hashCode());
        result = prime * result + ((getDprice() == null) ? 0 : getDprice().hashCode());
        result = prime * result + ((getDpwd() == null) ? 0 : getDpwd().hashCode());
        result = prime * result + ((getDpic() == null) ? 0 : getDpic().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", did=").append(did);
        sb.append(", ltid=").append(ltid);
        sb.append(", dname=").append(dname);
        sb.append(", dsex=").append(dsex);
        sb.append(", dbirthday=").append(dbirthday);
        sb.append(", djointime=").append(djointime);
        sb.append(", ddesc=").append(ddesc);
        sb.append(", dprice=").append(dprice);
        sb.append(", dpwd=").append(dpwd);
        sb.append(", dpic=").append(dpic);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}